import { getToken } from 'utils/token'
import { Navigate } from "react-router-dom";
import PropTypes from "prop-types";

export function AuthRoute({ children }) {
  const token = getToken();
  // 判断是否登录
  if (!token) {
    return <Navigate to="/login" />;
  }else {
    return children;
  }
}
AuthRoute.propTypes = {
  children: PropTypes.element.isRequired,
};
